#include <iostream>

using namespace std;
using ll=long long;
ll n,value;
bool check(ll mid)
{
	ll t=mid;
	ll sum=0;
	while(t)
	{
		sum+=t%10;
		t/=10;
	}
	return mid-sum>=value;
}
int main()
{
	
	cin>>n>>value;
	
	ll left=1,right=n;
	while(left<right)
	{
		ll mid=left+right>>1;
		if(check(mid))
		{
			right=mid;

		}
		else{
			left=mid+1;
		}
	}
	cout<<n-left+1;
	return 0;
}
